package leetcode4;

import java.util.*;
public class Main {

    public static void main(String[] zz) {
        Scanner sc  = new Scanner(System.in);
        //while(sc.hasNextLine()) {
        char[] s = sc.nextLine().toCharArray();
        //当第一次出现c的时候，计算它们的长度
        //boolean bool = false;
        int len = -1;
        int[] hash = new int[26];
        //Map<Character,Integer> map = new HashMap<>();
        for(int left=0,right=0;right<s.length;right++) {
            System.out.println(s[right]-'0');
            hash[(s[right]-'0')-97]++;//入窗口
            while(left<=right && hash[('c'-'0')-97]>0) { //
                len = Math.max(len,right-left+1);
                hash[(s[left]-'0')-97]--;
                left++;
            }
        }
        System.out.println(len==-1?s.length:len);
        //}
    }
}